<template>
	<view class="theme-item">
		<navigator :url="`/pages/classlist/classlist?id=${item._id}&name=${item.name}`" class="box" v-if="!isMore">
			<image :src="item.picurl" mode="aspectFill" class="pic"></image>
			<view class="mask">
				{{ item.name }}
			</view>
			<view class="tab">
				{{ compareTimestamp(item.updateTime) }}更新
			</view>
		</navigator>

		<view class="box more" v-if="isMore" @click="goClassify">
			<image src="../../common/images/more.jpg" mode="aspectFill" class="pic"></image>
			<view class="mask">
				<uni-icons type="more-filled" size="30" color="#fff"></uni-icons>
				<view class="text">
					更多
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
import { compareTimestamp } from '@/utils/time.js'
defineProps({
	isMore: {
		type: Boolean,
		default: false
	},
	item: {
		type: Object,
		default() {
			return {
				name: '默认名称',
				picurl: '../../common/images/more.jpg',
				
			}
		}
	}
})
const goClassify = () =>{
	uni.reLaunch({ url: '/pages/classify/classify' })
}
</script>

<style lang="scss">
.theme-item {
	.box {
		height: 340rpx;
		border-radius: 10rpx;
		overflow: hidden;
		position: relative;

		.pic {
			height: 100%;
			width: 100%;
		}

		.mask {
			position: absolute;
			width: 100%;
			height: 70rpx;
			font-size: 30rpx;
			color: white;
			bottom: 0;
			left: 0;
			background: rgba(0, 0, 0, 0.2);
			display: flex;
			align-items: center;
			justify-content: center;
			backdrop-filter: blur(20rpx);
		}

		.tab {
			padding: 6rpx 14rpx;
			position: absolute;
			left: 0;
			top: 0;
			background-color: #da9068;
			color: white;
			font-size: 22rpx;
			border-radius: 0 0 20rpx 0;
		}
	}

	.box.more {
		.mask {
			width: 100%;
			height: 100%;
			flex-direction: column;
		}

		.text {
			font-size: 28rpx;
			color: white;
		}
	}
}
</style>